/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ecfdb;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author SIDALI
 */
@Entity
@Table(name = "credit_fellah", catalog = "mandataire", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CreditFellah.findAll", query = "SELECT c FROM CreditFellah c"),
    @NamedQuery(name = "CreditFellah.findByIdcredit", query = "SELECT c FROM CreditFellah c WHERE c.idcredit = :idcredit"),
    @NamedQuery(name = "CreditFellah.findBySomme", query = "SELECT c FROM CreditFellah c WHERE c.somme = :somme"),
    @NamedQuery(name = "CreditFellah.findByDate", query = "SELECT c FROM CreditFellah c WHERE c.date = :date")})
public class CreditFellah implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idcredit", nullable = false)
    private Integer idcredit;
    @Column(name = "somme")
    private Integer somme;
    @Column(name = "date")
    @Temporal(TemporalType.TIMESTAMP)
    private Date date;
    @JoinColumn(name = "id_depot", referencedColumnName = "iddepot")
    @ManyToOne
    private Depot idDepot;
    @JoinColumn(name = "id_fellah", referencedColumnName = "idfellah")
    @ManyToOne
    private Fellah idFellah;

    public CreditFellah() {
    }

    public CreditFellah(Integer idcredit) {
        this.idcredit = idcredit;
    }

    public Integer getIdcredit() {
        return idcredit;
    }

    public void setIdcredit(Integer idcredit) {
        this.idcredit = idcredit;
    }

    public Integer getSomme() {
        return somme;
    }

    public void setSomme(Integer somme) {
        this.somme = somme;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public Depot getIdDepot() {
        return idDepot;
    }

    public void setIdDepot(Depot idDepot) {
        this.idDepot = idDepot;
    }

    public Fellah getIdFellah() {
        return idFellah;
    }

    public void setIdFellah(Fellah idFellah) {
        this.idFellah = idFellah;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idcredit != null ? idcredit.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CreditFellah)) {
            return false;
        }
        CreditFellah other = (CreditFellah) object;
        if ((this.idcredit == null && other.idcredit != null) || (this.idcredit != null && !this.idcredit.equals(other.idcredit))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ecfdb.CreditFellah[ idcredit=" + idcredit + " ]";
    }
    
}
